/**
 * swagger接口文档内容
 * 下方swagger接口文档的配置数据可通过 apifox 工具生成，调试接口时使用 apifox 工具，然后使用该工具导出 OpenApi 格式（Swagger 3.0）的数据，将这些数据替换下面swaggerApiDocs对象内容即可。（当然，也可以直接使用 apifox 工具提供的在线或离线接口文档）
 * 注意 apifox 工具的版本，最好更新到最新版本，不然导出的 swagger 数据会缺少 Auth 中的参数。
 */

const swaggerApiDocs = {
  openapi: "3.0.1",
  info: {
    title: "koa2-api项目",
    description: "",
    version: "1.0.0",
  },
  tags: [
    {
      name: "用户模块",
    },
    {
      name: "商品模块",
    },
    {
      name: "购物车模块",
    },
    {
      name: "地址模块",
    },
    {
      name: "订单模块",
    },
  ],
  paths: {
    "/user/register": {
      post: {
        summary: "用户注册",
        deprecated: false,
        description: "",
        tags: ["用户模块"],
        parameters: [],
        requestBody: {
          content: {
            "application/json": {
              schema: {
                type: "object",
                properties: {
                  user_name: {
                    type: "string",
                    title: "用户名",
                  },
                  password: {
                    type: "string",
                    title: "密码",
                  },
                },
                required: ["user_name", "password"],
              },
            },
          },
        },
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [],
      },
    },
    "/user/login": {
      post: {
        summary: "用户登录",
        deprecated: false,
        description: "",
        tags: ["用户模块"],
        parameters: [],
        requestBody: {
          content: {
            "application/json": {
              schema: {
                type: "object",
                properties: {
                  user_name: {
                    type: "string",
                  },
                  password: {
                    type: "string",
                  },
                },
                required: ["user_name", "password"],
              },
            },
          },
        },
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [],
      },
    },
    "/user/modifyPassword": {
      patch: {
        summary: "修改密码",
        deprecated: false,
        description: "",
        tags: ["用户模块"],
        parameters: [],
        requestBody: {
          content: {
            "application/json": {
              schema: {
                type: "object",
                properties: {
                  password: {
                    type: "string",
                  },
                },
                required: ["password"],
              },
            },
          },
        },
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
    },
    "/goods/upload": {
      post: {
        summary: "上传文件",
        deprecated: false,
        description: "",
        tags: ["商品模块"],
        parameters: [],
        requestBody: {
          content: {
            "multipart/form-data": {
              schema: {
                type: "object",
                properties: {
                  file: {
                    description: "文件自定义的key，可设置为其他名字",
                    example: "file://E:\\Pictures\\Texture\\lensflare0.png",
                    type: "string",
                    format: "binary",
                  },
                },
              },
            },
          },
        },
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
    },
    "/goods": {
      post: {
        summary: "发布商品",
        deprecated: false,
        description: "",
        tags: ["商品模块"],
        parameters: [],
        requestBody: {
          content: {
            "application/json": {
              schema: {
                type: "object",
                properties: {
                  goods_name: {
                    type: "string",
                  },
                  goods_price: {
                    type: "number",
                  },
                  goods_num: {
                    type: "number",
                  },
                  goods_img: {
                    type: "string",
                  },
                },
                required: ["goods_name", "goods_price", "goods_num", "goods_img"],
              },
            },
          },
        },
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
      get: {
        summary: "获取商品列表",
        deprecated: false,
        description: "",
        tags: ["商品模块"],
        parameters: [
          {
            name: "pageNum",
            in: "query",
            description: "",
            required: false,
            example: 1,
            schema: {
              type: "integer",
            },
          },
          {
            name: "pageSize",
            in: "query",
            description: "",
            required: false,
            example: 10,
            schema: {
              type: "integer",
            },
          },
        ],
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
    },
    "/goods/6": {
      put: {
        summary: "更新商品",
        deprecated: false,
        description: "",
        tags: ["商品模块"],
        parameters: [],
        requestBody: {
          content: {
            "application/json": {
              schema: {
                type: "object",
                properties: {
                  goods_name: {
                    type: "string",
                  },
                  goods_price: {
                    type: "number",
                  },
                  goods_num: {
                    type: "number",
                  },
                  goods_img: {
                    type: "string",
                  },
                },
                required: ["goods_name", "goods_price", "goods_num", "goods_img"],
              },
            },
          },
        },
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
    },
    "/goods/14": {
      delete: {
        summary: "删除商品（硬删除）",
        deprecated: false,
        description: "",
        tags: ["商品模块"],
        parameters: [],
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
    },
    "/goods/4/off": {
      post: {
        summary: "下架商品（软删除）",
        deprecated: false,
        description: "",
        tags: ["商品模块"],
        parameters: [],
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
    },
    "/goods/5/on": {
      post: {
        summary: "上架商品",
        deprecated: false,
        description: "",
        tags: ["商品模块"],
        parameters: [],
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
    },
    "/cart": {
      post: {
        summary: "加入购物车",
        deprecated: false,
        description: "",
        tags: ["购物车模块"],
        parameters: [],
        requestBody: {
          content: {
            "application/json": {
              schema: {
                type: "object",
                properties: {
                  goods_id: {
                    type: "number",
                  },
                },
                required: ["goods_id"],
              },
            },
          },
        },
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
      get: {
        summary: "查询购物车列表",
        deprecated: false,
        description: "",
        tags: ["购物车模块"],
        parameters: [
          {
            name: "pageNum",
            in: "query",
            description: "",
            required: false,
            example: 1,
            schema: {
              type: "integer",
            },
          },
          {
            name: "pageSize",
            in: "query",
            description: "",
            required: false,
            example: 10,
            schema: {
              type: "integer",
            },
          },
        ],
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
      delete: {
        summary: "删除购物车",
        deprecated: false,
        description: "",
        tags: ["购物车模块"],
        parameters: [],
        requestBody: {
          content: {
            "application/json": {
              schema: {
                type: "object",
                properties: {
                  ids: {
                    type: "array",
                    items: {
                      type: "number",
                    },
                  },
                },
                required: ["ids"],
              },
            },
          },
        },
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
    },
    "/cart/7": {
      patch: {
        summary: "更新购物车",
        deprecated: false,
        description: "",
        tags: ["购物车模块"],
        parameters: [],
        requestBody: {
          content: {
            "application/json": {
              schema: {
                type: "object",
                properties: {
                  number: {
                    type: "integer",
                  },
                  selected: {
                    type: "boolean",
                  },
                },
                required: ["number", "selected"],
              },
            },
          },
        },
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
    },
    "/cart/batchSelected": {
      post: {
        summary: "批量更新购物车的选中状态",
        deprecated: false,
        description: "",
        tags: ["购物车模块"],
        parameters: [],
        requestBody: {
          content: {
            "application/json": {
              schema: {
                type: "object",
                properties: {
                  selected: {
                    type: "boolean",
                  },
                },
                required: ["selected"],
              },
            },
          },
        },
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
    },
    "/cart/total": {
      get: {
        summary: "查询购物车总数",
        deprecated: false,
        description: "",
        tags: ["购物车模块"],
        parameters: [],
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
    },
    "/address": {
      post: {
        summary: "添加地址",
        deprecated: false,
        description: "",
        tags: ["地址模块"],
        parameters: [],
        requestBody: {
          content: {
            "application/json": {
              schema: {
                type: "object",
                properties: {
                  consignee: {
                    type: "string",
                  },
                  phone: {
                    type: "string",
                  },
                  address: {
                    type: "string",
                  },
                },
                required: ["consignee", "phone", "address"],
              },
            },
          },
        },
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
      get: {
        summary: "获取用户的所有收货人地址",
        deprecated: false,
        description: "",
        tags: ["地址模块"],
        parameters: [],
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
    },
    "/address/4": {
      put: {
        summary: "更新地址",
        deprecated: false,
        description: "",
        tags: ["地址模块"],
        parameters: [],
        requestBody: {
          content: {
            "application/json": {
              schema: {
                type: "object",
                properties: {
                  consignee: {
                    type: "string",
                  },
                  phone: {
                    type: "string",
                  },
                  address: {
                    type: "string",
                  },
                },
                required: ["consignee", "phone", "address"],
              },
            },
          },
        },
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
    },
    "/address/7": {
      delete: {
        summary: "根据地址id删除地址",
        deprecated: false,
        description: "",
        tags: ["地址模块"],
        parameters: [],
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
    },
    "/address/2": {
      patch: {
        summary: "设置默认地址",
        deprecated: false,
        description: "",
        tags: ["地址模块"],
        parameters: [],
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
    },
    "/order": {
      post: {
        summary: "提交订单",
        deprecated: false,
        description: "",
        tags: ["订单模块"],
        parameters: [],
        requestBody: {
          content: {
            "application/json": {
              schema: {
                type: "object",
                properties: {
                  address_id: {
                    type: "integer",
                  },
                  goods_info: {
                    type: "string",
                  },
                  total: {
                    type: "number",
                  },
                },
                required: ["address_id", "goods_info", "total"],
              },
            },
          },
        },
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
      get: {
        summary: "获取订单列表",
        deprecated: false,
        description: "",
        tags: ["订单模块"],
        parameters: [
          {
            name: "pageNum",
            in: "query",
            description: "",
            required: false,
            example: 1,
            schema: {
              type: "integer",
            },
          },
          {
            name: "pageSize",
            in: "query",
            description: "",
            required: false,
            example: 10,
            schema: {
              type: "integer",
            },
          },
          {
            name: "status",
            in: "query",
            description: "",
            required: false,
            example: 0,
            schema: {
              type: "integer",
            },
          },
        ],
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
    },
    "/order/1": {
      patch: {
        summary: "更新订单状态",
        deprecated: false,
        description: "",
        tags: ["订单模块"],
        parameters: [],
        requestBody: {
          content: {
            "application/json": {
              schema: {
                type: "object",
                properties: {
                  status: {
                    type: "number",
                  },
                },
                required: ["status"],
              },
            },
          },
        },
        responses: {
          200: {
            description: "",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {},
                },
              },
            },
            headers: {},
          },
        },
        security: [
          {
            bearer: [],
          },
        ],
      },
    },
  },
  components: {
    schemas: {},
    securitySchemes: {
      bearer: {
        type: "http",
        scheme: "bearer",
      },
    },
  },
  servers: [],
  security: [
    {
      bearer: [],
    },
  ],
};

module.exports = swaggerApiDocs;
